=== Latest Posts Grid ===
Contributors: Tariqul Islam
Donate link: https://digitalhubit.com/donate
Tags: posts, grid, latest posts, category filter, shortcode, pagination, title capitalization, button color, featured image, pagination colors
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
Stable tag: 1.6
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Display your latest posts in a customizable grid layout with admin dashboard controls, pagination, title capitalization options, custom button colors, featured image control, and comprehensive pagination color customization.

== Description ==

Latest Posts Grid is a powerful yet user-friendly WordPress plugin that allows you to display your latest posts in a beautiful, responsive grid layout. With an intuitive admin dashboard, you can create and manage multiple grid configurations and easily add them to your posts or pages using shortcodes.

= 🎨 Key Features =

**Design & Layout**
* Responsive grid layouts (1-6 columns)
* Automatic mobile optimization
* Clean, modern card-based design
* Featured image on/off control
* Dark mode and high contrast support

**Content Customization** 
* **Title capitalization options** - Choose from Default, UPPERCASE, lowercase, Title Case, or Sentence case
* **Custom button colors** - Set custom colors for "Read More" buttons with color picker
* **Featured image control** - Show or hide featured images in your grid
* Update information display (publication date and author)
* Post excerpt with customizable length
* Category filtering and display

**Pagination Features**
* **Complete pagination color customization** - Background, text, active, and hover colors
* Multiple pagination styles: Numbers only, Previous/Next only, or "1,2,3.....121 Next →" format
* SEO-friendly URL structure
* Mobile-responsive pagination

**Admin Experience**
* Intuitive tabbed admin interface
* Live color preview for buttons and pagination
* Visual shortcode builder
* Save multiple grid configurations
* Copy shortcode to clipboard
* Edit existing grids easily

**Developer Features**
* Clean, well-documented code
* WordPress coding standards compliant
* Extensive hooks and filters
* Secure nonce verification
* Proper data sanitization
* Accessibility-compliant markup

= 🚀 How It Works =

Each grid displays posts with:
* Post title (with customizable capitalization and links)
* Update information in "March 29, 2025 by Author" format
* Post categories (with links)
* Post excerpt
* Featured image (if available and enabled)
* Customizable "Read More" button with your chosen colors

The grid layout automatically adjusts to different screen sizes:
* **Desktop**: Shows your selected number of columns
* **Tablet**: Reduces to 2-3 columns
* **Mobile**: Shows a single column for optimal readability

= 📱 Responsive Design =

The plugin is built with mobile-first design principles:
* Automatic column reduction on smaller screens
* Touch-friendly pagination controls
* Optimized image loading
* Readable typography at all screen sizes

= 🎯 Perfect For =

* Blog post showcases
* Portfolio displays
* News and magazine sites
* Business websites
* E-commerce product blogs
* Multi-author sites
* Category-specific content areas

= 🔒 Security Features =

* Enhanced nonce verification
* Input validation with proper ranges
* XSS prevention with output escaping
* Secure file operations
* User capability checks
* Error logging and handling

== Installation ==

= Automatic Installation =
1. Log in to your WordPress admin dashboard
2. Navigate to Plugins → Add New
3. Search for "Latest Posts Grid"
4. Click "Install Now" and then "Activate"

= Manual Installation =
1. Download the plugin zip file
2. Upload to `/wp-content/plugins/latest-posts-grid/`
3. Activate the plugin through the 'Plugins' menu in WordPress

= Getting Started =
1. Go to **Posts Grid** in your WordPress admin menu
2. Create your first grid in the "Create Grid" tab
3. Customize colors, layout, and settings
4. Copy and paste the generated shortcode into any post or page

== Frequently Asked Questions ==

= Can I display posts from specific categories only? =

Yes! When creating a grid, you can select which categories to include. If you don't select any categories, posts from all categories will be displayed.

= How many columns can I display? =

You can choose between 1 and 6 columns. The grid automatically adjusts to different screen sizes for optimal viewing on all devices.

= Can I customize how post titles appear? =

Absolutely! You can choose from 5 different title capitalization options:
- **Default** (original formatting)
- **UPPERCASE** (ALL CAPS)
- **lowercase** (all lowercase)
- **Title Case** (First Letter Of Each Word)
- **Sentence case** (Only first letter capitalized)

= Can I customize the button colors? =

Yes! You can set custom colors for both the normal state and hover state of the "Read More" button. The plugin includes WordPress color pickers for easy color selection with live preview.

= Can I hide featured images? =

Absolutely! You can control whether featured images are displayed in your grid. When disabled, only the text content (title, excerpt, etc.) will be shown for a cleaner, text-focused layout.

= Can I customize pagination colors? =

Yes! You have complete control over pagination colors:
- **Pagination Background** - Background color of pagination buttons
- **Pagination Text Color** - Text color of page numbers
- **Active Page Color** - Color of the currently selected page
- **Pagination Hover Color** - Background color when hovering over buttons

= Can I use hex color codes? =

Yes! The color picker accepts hex color codes directly. You can type in codes like #ff5722 or #3498db, or use the visual color picker.

= Can I display posts in a specific order? =

Yes! You can choose to display posts in ascending (oldest first) or descending (newest first) order, and sort them by:
- Date
- Title
- Last modified date
- Comment count
- Random order

= How does pagination work? =

You can enable pagination and choose from three styles:
- **Numbers Only** - Simple numeric pagination (1,2,3.....121)
- **Previous/Next Only** - Just previous and next buttons
- **Numbers with Next Button** - Clean "1,2,3.....121 Next →" format

= Can I create multiple grid layouts? =

Yes! You can create as many grid layouts as you need, each with unique settings including colors, layout, and content options. Each grid gets its own shortcode.

= What if I need to edit an existing grid? =

Easy! Go to the "Saved Grids" tab and click "Edit" next to any grid. You can modify all settings including colors, and the changes will automatically apply wherever the shortcode is used.

= Is the plugin responsive? =

Absolutely! The grid automatically adapts to different screen sizes, ensuring your posts look great on desktop, tablet, and mobile devices.

= Are there accessibility features? =

Yes! The plugin includes:
- Proper focus states for keyboard navigation
- High contrast mode support
- Semantic HTML markup
- Screen reader friendly content
- Reduced motion support for users with vestibular disorders

== Screenshots ==

1. **Admin Dashboard** - Create Grid tab with all customization options
2. **Color Customization** - Button and pagination color pickers with live preview
3. **Saved Grids Management** - Overview of all saved grid configurations
4. **Frontend Grid Display** - Beautiful responsive grid layout
5. **Mobile Responsive** - Grid automatically adapts to mobile screens
6. **Title Capitalization Options** - Live preview of different title styles
7. **Pagination Styles** - Different pagination display options

== Changelog ==

= 1.6 =
**🚀 MAJOR SECURITY & STABILITY UPDATE**
* **SECURITY**: Enhanced nonce verification with proper error handling
* **SECURITY**: Added input validation with proper ranges (columns: 1-6, posts: 1-100)
* **SECURITY**: Implemented secure file operations with permission checks
* **SECURITY**: Enhanced XSS prevention with comprehensive output escaping
* **SECURITY**: Added color validation with sanitize_hex_color()
* **SECURITY**: Implemented category validation checking term existence
* **FIXED**: Resolved white screen issue after save button click
* **FIXED**: Added JavaScript error handling with try-catch blocks
* **FIXED**: Implemented safe color picker access with fallback values
* **FIXED**: Removed page reload that caused white screens
* **FIXED**: Added AJAX timeout handling (30-second timeouts)
* **IMPROVED**: Better dependency checking for jQuery UI
* **IMPROVED**: Local jQuery UI CSS instead of external CDN
* **IMPROVED**: Enhanced error logging for debugging
* **IMPROVED**: Graceful error handling for shortcode display
* **IMPROVED**: Database optimization with better option handling
* **NEW**: Comprehensive error messages for troubleshooting
* **NEW**: Admin notification system for activation errors
* **NEW**: Enhanced debugging information in browser console

= 1.5 =
* Added featured image on/off control - choose to show or hide featured images
* Added comprehensive pagination color customization (background, text, active, hover colors)
* Enhanced admin interface with live pagination color preview
* Improved grid layout styling for posts without featured images
* Added color preview functionality for pagination settings
* Enhanced responsive design for new color picker fields
* Updated admin form organization for better user experience
* Added validation and sanitization for new color fields
* Improved CSS for better handling of grids without featured images
* Updated help documentation with new feature explanations

= 1.4 =
* Added custom button color functionality with color picker
* Added button hover color customization
* Enhanced admin interface with live button color preview
* Improved color picker integration with WordPress color picker
* Added color preview in saved grids table
* Enhanced CSS for better button styling and animations
* Added support for accessibility features (high contrast, reduced motion)
* Improved responsive design for color picker on mobile
* Added automatic text color contrast for button readability
* Enhanced button animations and hover effects
* Updated admin styles for better color picker experience
* Added RTL (Right-to-Left) language support
* Improved print styles for better document printing

= 1.3 =
* Added title capitalization options (Default, UPPERCASE, lowercase, Title Case, Sentence case)
* Enhanced admin interface with title capitalization live preview
* Fixed tab display issues with improved jQuery UI loading and fallback system
* Improved CSS styling for title capitalization classes
* Updated admin JavaScript with better error handling and debugging
* Added title style display in saved grids table
* Enhanced form validation and user feedback
* Improved responsive design for admin interface
* Better clipboard functionality for copying shortcodes
* Fixed CSS conflicts with WordPress admin styles
* Added inline debugging for troubleshooting

= 1.2 =
* Added pagination functionality for displaying all posts
* Added options for pagination display styles including "1,2,3.....121 Next →" format
* Updated CSS styles for pagination elements
* Updated admin interface with pagination settings

= 1.1 =
* Added stylish update information in "Date by Author" format
* Replaced separate author and date display with linked categories
* Improved post meta styling and organization

= 1.0 =
* Initial release
* Basic grid functionality
* Admin dashboard
* Shortcode support
* Responsive design

== Upgrade Notice ==

= 1.6 =
🔒 CRITICAL SECURITY UPDATE: This version fixes important security vulnerabilities and resolves the white screen issue. All users should update immediately. Includes enhanced input validation, XSS prevention, secure file operations, and comprehensive error handling. The admin interface is now more stable with better JavaScript error handling and AJAX timeout management.

= 1.5 =
Major feature update! Now includes featured image control and comprehensive pagination color customization. You can show/hide featured images and fully customize pagination colors including background, text, active page, and hover states. Perfect for creating unique, branded grid layouts that match your site's design.

= 1.4 =
Exciting new feature! Custom button colors with live preview. Set custom colors for your "Read More" buttons using WordPress color pickers. Includes hover colors, accessibility features, and enhanced admin experience. Update now to make your grids truly unique!

= 1.3 =
Major admin interface improvements! New title capitalization options with live preview, better tab functionality, and enhanced user experience. Choose from 5 different title styles and enjoy a more stable admin interface.

== Technical Requirements ==

= Minimum Requirements =
* WordPress 5.0 or higher
* PHP 7.4 or higher
* MySQL 5.6 or higher

= Recommended Requirements =
* WordPress 6.0 or higher
* PHP 8.0 or higher  
* MySQL 8.0 or higher

= Browser Compatibility =
* Chrome 60+
* Firefox 55+
* Safari 12+
* Edge 79+
* Internet Explorer 11+ (limited support)

== Support ==

For support, feature requests, or bug reports:

* **Documentation**: Check the "How to Use" tab in the plugin admin
* **WordPress Support Forum**: Visit the plugin support forum
* **Website**: https://digitalhubit.com/latest-posts-grid

== Privacy Policy ==

This plugin does not collect, store, or transmit any personal data from your website visitors. All configuration data is stored locally in your WordPress database and never shared with external services.

== Contributing ==

We welcome contributions! The plugin follows WordPress coding standards and includes comprehensive security measures. All code contributions are reviewed for security and compatibility.

== Credits ==

* **Icons**: WordPress Dashicons
* **UI Framework**: jQuery UI
* **Color Picker**: WordPress Color Picker API
* **Layout**: CSS Grid with Flexbox fallbacks
* **Security**: WordPress Security Standards

== License ==

This plugin is licensed under the GPL v2 or later.

> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation.

> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.